//
//  QRSubListViewController.m
//  EducationOID
//
//  Created by slz on 2017/5/17.
//  Copyright © 2017年 bnsr. All rights reserved.
//

#import "QRSubListViewController.h"
#import "QRListTableViewCell.h"

@interface QRSubListViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) YWTableView *tableView;
@property (nonatomic,strong) NSArray *dataSource;
@end

@implementation QRSubListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.showNavigationBar = YES;
    self.view.backgroundColor = [UIColor whiteColor];
    UIBarButtonItem * item = [UIBarButtonItem itemWithImage:@"top_back_1" selectImage:nil addTarget:self andAction:@selector(backAction)];
    self.navigationItem.leftBarButtonItem = item;
    [self setControllerTitle:@"生成码"];
    [self initTableView];
    _dataSource = @[@"",@""];
    // Do any additional setup after loading the view.
}

- (void)initTableView{
    _tableView = [YWTableView new];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    _tableView.showsVerticalScrollIndicator = NO;
    _tableView.showsHorizontalScrollIndicator = NO;
    [self.view addSubview:_tableView];
    @weakify(self);
    [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(weak_self.view);
    }];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString * reuserString = @"QRListTableViewCell";
    QRListTableViewCell * homeCell = [tableView dequeueReusableCellWithIdentifier:reuserString];
    if (homeCell == nil){
        homeCell = [[QRListTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuserString];
        homeCell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    homeCell.mainLabel.text = _dataSource[indexPath.row];
    return homeCell;
}

- (void)backAction{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if(indexPath.row == 0){
        
    }else{
        
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
